#ifndef __EXTERNAL_FORCE_INTERFACE_V1_0_0__
#define __EXTERNAL_FORCE_INTERFACE_V1_0_0__

#ifdef WIN32
    #ifdef __cplusplus
        #define EXPORT_MACRO extern "C" __declspec(dllexport)
    #else
        #define EXPORT_MACRO __declspec(dllexport)
    #endif
#else
    #ifdef __cplusplus
        #define EXPORT_MACRO extern "C"
    #else
        #define EXPORT_MACRO
    #endif
#endif

//Return values from EXTERNALFORCE
#define EF_SUCCESS                  0
#define EF_ERR_NO_PREFERENCES_FILE -1

//interface version info (not to be modified)
#define EF_INTERFACE_MAJOR_VERSION 0x01
#define EF_INTERFACE_MINOR_VERSION 0x00
#define EF_INTERFACE_SUB_VERSION   0x00

//size of strings passed into functions (not to be modified)
#define EF_PREF_FILE_BUFF_SIZE  128


/* This function should not be modified */
EXPORT_MACRO int GETEFINTERFACEVERSION()
{
    return (EF_INTERFACE_MAJOR_VERSION << 16 | EF_INTERFACE_MINOR_VERSION << 8 | EF_INTERFACE_SUB_VERSION);
}

/*
 * The following functions require to be implemented before your plugin
 * can be loaded and used:
 *
 * GETEFPREFERENCEFILE
 *     returns the name of the config file used by this contact model (if any)
 *
 * EXTERNALFORCE
 *     does the actual force calculation for the contact
 */

/**
 * Specifies the name of the config file used by the plugin.
 * @Param caPrefFile (Return value) A character array to be populated with the
 *                   config file name.
 *                   This path is relative to the directory the plugin is stored in.
 */
EXPORT_MACRO void GETEFPREFERENCEFILE(char caPrefFile[EF_PREF_FILE_BUFF_SIZE]);

/**
 * This function is called every single time step for every single particle. It allows
 * the user to add an external force (e.g. electromagnetic force, drag force) to particles.
 * The following parameters are taken in by the function (and should not be altered):
 *
 * GENERAL INFORMATION
 * -------------------
 *
 * sPrefFile - name & location of the optional preferences file.
 * nTime     - the current simulation time
 * nTimeStep - the current simulation time step
 *
 * PARTICLE INFORMATION
 * -------------------
 *
 * nId           - the number id of the particle (these are unique)
 * sType         - a char * containing the particle prototype this surface was created from
 * nMass         - the mass
 * nVolume       - the volume
 * nPosX,Y,Z     - the x, y, z coordinates of the centroid
 * nVelX,Y,Z     - the x, y, z components of velocity
 * nAngVelX,Y,Z  - the x, y, z components of angular velocity
 * nOrientXX,Y,Z - the components of the orientation matrix
 *
 * The following information concerns the magnitude of the forces and torques on the particle and should be filled
 * in by the user.
 *
 * FORCES & TORQUES
 * ----------------
 *
 * nForceX,Y,Z  - The x, y, z components of the external force on the particle. This force is taken to act at the particle centroid.
 * nTorqueX,Y,Z - The x, y, z components of the external torque on the particle. This torque is in global coordinates
 *
 * The function should return a value to indicate success or failure (see error codes defined above).
 *
 * For additional information please see the help, or one of the examples included in with the product.
 */
EXPORT_MACRO int EXTERNALFORCE(const char *sPrefFile, double *nTime, double *nTimeStep,
                               int *nId, const char *sType,double *nMass,
                               double *nVolume, double *nPosX, double *nPosY, double *nPosZ,
                               double *nVelX, double *nVelY, double *nVelZ,
                               double *nAngVelX, double *nAngVelY, double *nAngVelZ,
                               double *nOrientXX, double *nOrientXY, double *nOrientXZ,
                               double *nOrientYX, double *nOrientYY, double *nOrientYZ,
                               double *nOrientZX, double *nOrientZY, double *nOrientZZ,
                               double *nForceX, double *nForceY, double *nForceZ,
                               double *nTorqueX, double *nTorqueY, double *nTorqueZ);

#endif

